package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Francis
 */
@Entity
@Table(name = "coupon_type")
@NamedQueries({@NamedQuery(name = "Coupon.findByCouponID", query = "SELECT c FROM Coupon c WHERE c.couponID = :couponID"), @NamedQuery(name = "Coupon.findByName", query = "SELECT c FROM Coupon c WHERE c.name = :name"), @NamedQuery(name = "Coupon.findByExpire", query = "SELECT c FROM Coupon c WHERE c.expire = :expire"), @NamedQuery(name = "Coupon.findByValue", query = "SELECT c FROM Coupon c WHERE c.value = :value"), @NamedQuery(name = "Coupon.findByPersonID", query = "SELECT c FROM Coupon c WHERE c.personID = :personID"), @NamedQuery(name = "Coupon.findByDescription", query = "SELECT c FROM Coupon c WHERE c.description = :description"), @NamedQuery(name = "Coupon.findByPrice", query = "SELECT c FROM Coupon c WHERE c.price = :price"), @NamedQuery(name = "Coupon.findByQuantity", query = "SELECT c FROM Coupon c WHERE c.quantity = :quantity"), @NamedQuery(name = "Coupon.findByStatusCode", query = "SELECT c FROM Coupon c WHERE c.statusCode = :statusCode"), @NamedQuery(name = "Coupon.findByLocation", query = "SELECT c FROM Coupon c WHERE c.location = :location"), @NamedQuery(name = "Coupon.findByImage1", query = "SELECT c FROM Coupon c WHERE c.image1 = :image1"), @NamedQuery(name = "Coupon.findByImage2", query = "SELECT c FROM Coupon c WHERE c.image2 = :image2"), @NamedQuery(name = "Coupon.findByImage3", query = "SELECT c FROM Coupon c WHERE c.image3 = :image3")})
public class Coupon implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "couponID", nullable = false)
    private Integer couponID;
    @Column(name = "name", nullable = false)
    private String name;
    @Column(name = "expire", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date expire;
    @Column(name = "value", nullable = false)
    private String value;
    @Column(name = "personID", nullable = false)
    private int personID;
    @Column(name = "description")
    private String description;
    @Column(name = "price")
    private BigDecimal price;
    @Column(name = "quantity")
    private Integer quantity;
    @Column(name = "statusCode")
    private Integer statusCode;
    @Column(name = "location")
    private String location;
    @Column(name = "image1")
    private String image1;
    @Column(name = "image2")
    private String image2;
    @Column(name = "image3")
    private String image3;

    public Coupon() {
    }

    public Coupon(Integer couponID) {
        this.couponID = couponID;
    }

    public Coupon(Integer couponID, String name, Date expire, String value, int personID) {
        this.couponID = couponID;
        this.name = name;
        this.expire = expire;
        this.value = value;
        this.personID = personID;
    }

    public Integer getCouponID() {
        return couponID;
    }

    public void setCouponID(Integer couponID) {
        this.couponID = couponID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getExpire() {
        return expire;
    }

    public void setExpire(Date expire) {
        this.expire = expire;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public int getPersonID() {
        return personID;
    }

    public void setPersonID(int personID) {
        this.personID = personID;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public Integer getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getImage1() {
        return image1;
    }

    public void setImage1(String image1) {
        this.image1 = image1;
    }

    public String getImage2() {
        return image2;
    }

    public void setImage2(String image2) {
        this.image2 = image2;
    }

    public String getImage3() {
        return image3;
    }

    public void setImage3(String image3) {
        this.image3 = image3;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (couponID != null ? couponID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Coupon)) {
            return false;
        }
        Coupon other = (Coupon) object;
        if ((this.couponID == null && other.couponID != null) || (this.couponID != null && !this.couponID.equals(other.couponID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Coupon[couponID=" + couponID + "]";
    }
}
